package com.hzlx.controller;/*
 *@author liu
 *2024/07/2024/7/25
 *@version
 */


import com.hzlx.common.ResponseBean;
import com.hzlx.service.CustomerAccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Author UP
 * @Date 2024/7/25 14:30
 * @Version 1.0
 **/
@Controller
@RequestMapping("/customer_account")
public class CustomerAccountController {
    @Autowired
    private CustomerAccountService customerAccountService;

    @GetMapping("/home")
    public String home(Model model){
        customerAccountService.getCustomerAccount(model);
        customerAccountService.getCustomerBankCard(model);
        return "pages/home";
    }

    @PostMapping("/withdrawal")
    public String withdrawal(Model model){
        return "withdrawal";
    }

    @ResponseBody
    @GetMapping("/getBalanceByCustomerId")
    public ResponseBean getBalanceByCustomerId(Integer customerId) {
        return customerAccountService.getBalanceByCustomerId(customerId);
    }
}
